package tedu.week04.day02_thread.lesson1;

/**
 * <pre>
 *      线程的礼让测试.
 * </pre>
 *
 * @author : resty
 * @date : 2019年07月08日    22时
 **/
public class ThreadYeild  implements  Runnable{



    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName());
        }
    }

    public static void main(String[] args){
        ThreadYeild ty1 = new ThreadYeild();
        ThreadYeild ty2 = new ThreadYeild();
        ThreadYeild ty3 = new ThreadYeild();

        Thread t1 = new Thread(ty1,"1");
        Thread t2 = new Thread(ty2,"2");
        Thread t3 = new Thread(ty3,"3");


        t1.start();
        t2.start();
        t3.start();
        t1.yield();
        t2.yield();




    }
}
